package com.coisini.mapper;

import com.coisini.annotation.AutoFill;
import com.coisini.dto.CategoryPageQueryDTO;
import com.coisini.entity.Category;
import com.coisini.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface CategoryMapper {

    /**
     * 分类分页查询
     * @param categoryPageQueryDTO
     */
    List<Category> pageQuery(CategoryPageQueryDTO categoryPageQueryDTO);

    /**
     * 修改分类
     * @param category
     */
    @AutoFill(value = OperationType.UPDATE)
    void update(Category category);

    /**
     * 新增分类
     * @param category
     */
    @AutoFill(value = OperationType.INSERT)
    void insert(Category category);

    /**
     * 根据类型查询分类
     * 查询 状态为启用状态的数据
     * @param type
     * @return
     */
    List<Category> getByType(Integer type);

    /**
     * 根据id删除数据
     * @param id
     */
    @Delete("delete  from skydelivery.category where id =#{id} ")
    void delete(Long id);
}
